I find a way to solve the issue and wrote an article about this. https://medium.com/@GalvinLi/fix-the-table-header-gap-in-ios-15-197debb92608
In short way:
Just set a tableHeaderView before table loaded.
- (void)viewDidLoad {
[super viewDidLoad];
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
}
or change it globally
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[UITableView appearance].tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
return YES;
}
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: